import 'package:equatable/equatable.dart';

/// 植物百科模型
/// 使用Equatable实现相等性比较
class PlantEncyclopediaModel extends Equatable {
  /// 植物ID
  final String id;

  /// 植物名称
  final String plantName;

  /// 封面图片路径
  final String coverImage;

  /// 植物图片路径
  final String plantImage;

  /// 科属信息
  final String familyAndGenus;

  /// 优势特点
  final String advantages;

  /// 栽培方式
  final String cultivation;

  /// 主要特征
  final String keyFeatures;

  /// 生长习性
  final String growthHabit;

  const PlantEncyclopediaModel({
    required this.id,
    required this.plantName,
    required this.coverImage,
    required this.plantImage,
    required this.familyAndGenus,
    required this.advantages,
    required this.cultivation,
    required this.keyFeatures,
    required this.growthHabit,
  });

  /// 复制并修改部分属性
  PlantEncyclopediaModel copyWith({
    String? id,
    String? plantName,
    String? coverImage,
    String? plantImage,
    String? familyAndGenus,
    String? advantages,
    String? cultivation,
    String? keyFeatures,
    String? growthHabit,
  }) {
    return PlantEncyclopediaModel(
      id: id ?? this.id,
      plantName: plantName ?? this.plantName,
      coverImage: coverImage ?? this.coverImage,
      plantImage: plantImage ?? this.plantImage,
      familyAndGenus: familyAndGenus ?? this.familyAndGenus,
      advantages: advantages ?? this.advantages,
      cultivation: cultivation ?? this.cultivation,
      keyFeatures: keyFeatures ?? this.keyFeatures,
      growthHabit: growthHabit ?? this.growthHabit,
    );
  }

  @override
  List<Object?> get props => [
    id,
    plantName,
    coverImage,
    plantImage,
    familyAndGenus,
    advantages,
    cultivation,
    keyFeatures,
    growthHabit,
  ];

  @override
  String toString() {
    return 'PlantEncyclopediaModel(id: $id, plantName: $plantName)';
  }
}
